*The Capitalist Peace;*begun 9/15/00, this version 01/12/07;set more off#delimit;set mem 250m;log using capitalistpeace_012007.log, replace;set matsize 160;use jpr128;compress;describe;summarize;*comment:  unique identifier for dyad year;gen long dyadidyr=((statea*1000000)+(stateb*1000)+(year-1000));la var dyadidyr "ID - unique dyad year identifier";*comment:  unique identifier for dyad;gen long dyadid=((statea*1000)+stateb);la var dyadid "ID - unique dyad identifier";*comment:  unique identifier for country year A;gen long cntryera=((statea*10000)+year);la var cntryera "ID - country year A";*comment:  unique identifier for country year B;gen long cntryerb=((stateb*10000)+year);la var cntryerb "ID - country year B";la var statea "ID - COW code for state A";la var stateb "ID - COW code for state B";la var year "ID - current year";sort dyadidyr;*comment:  identifying Oneal and Russett's data;la var onset1 "O&R - onset of dispute in year + 1";la var demauta "O&R - DEMOC-AUTOC: Polity III, 5-96";la var demautb "O&R - DEMOC-AUTOC: Polity III, 5-96";la var depa "O&R - bilateral X+M/GDP for State A";la var depb "O&R - bilateral X+M/GDP for State B";la var imputed "O&R - =1 if missing trade set to 0";la var depa_np "O&R - X+M/GDP, in national prices";la var depb_np "O&R - X+M/GDP, in national prices";la var alliesr "O&R - states a&b formally allied=1";la var conttype "O&R - type of contig: 1=by land";la var logdstab "O&R - ln of capital to capital distan";la var lncaprt "O&R - ln of COW capability ratio";la var yrspeace "O&R - Time since last onset1";*comment:  OPERATIONALIZING DEMOCRACY;*comment:  generating Oneal and Russett variables, Table 1 & 2;*comment:  normalize dem values on 0 to 10 scale;*replace demauta=((demauta+10)/2);*replace demautb=((demautb+10)/2);*comment:  lower of dyadic democracy scores, Table 1 & 2;gen demlo=demauta if demauta<=demautb & demauta~=. & demautb~=.;replace demlo=demautb if demauta>demautb & demauta~=. & demautb~=.;la var demlo "DEM - Lower of dyadic scores";*comment:  higher of dyadic democracy scores, Table 1 & 2;gen demhi=demauta if demauta>demautb & demauta~=. & demautb~=.;replace demhi=demautb if demauta<=demautb & demauta~=. & demautb~=.;la var demhi "DEM - Higher of dyadic scores";*comment:  joint dyadic democracy - Appendix;gen jntdem=(demauta*demautb);la var jntdem "DEM - Product of dyadic scores";*comment:  dichotomous democracy vars - Appendix;gen demdumya=1 if demauta>7 & demauta~=.;replace demdumya=0 if demauta<=7 & demauta~=.;gen demdumyb=1 if demautb>7 & demautb~=.;replace demdumyb=0 if demautb<=7 & demautb~=.;gen demdumy2=1 if demdumya==1 & demdumyb==1;replace demdumy2=0 if demdumya==0;replace demdumy2=0 if demdumyb==0;la var demdumy2 "DEM - dummy both demaut>7";gen demdumy1=1 if demdumya==1;replace demdumy1=1 if demdumyb==1;replace demdumy1=0 if demdumya==0 & demdumyb==0;la var demdumy1 "DEM - dummy either demaut>7";drop demdumya demdumyb;*comment:  OPERATIONALIZING MARKETS;*comment:  lower of dyadic trade dependence scores, Table 1 & 2;gen deplo=depa if depa<=depb & depa~=. & depb~=.;replace deplo=depb if depa>depb & depa~=. & depb~=.;la var deplo "IDEP - Lower of dyadic scores";*comment:  higher of dyadic dependence scores;gen dephi=depa if depa>depb & depa~=. & depb~=.;replace dephi=depb if depa<=depb & depa~=. & depb~=.;la var dephi "IDEP - Higher of dyadic scores";*comment:   joint dependence;gen jntdep=depa*depb;la var jntdep "IDEP - Product of dyadic scores";*comment:  lower of dyadic national price dependence scores, Gleditsch - Appendix;gen deplo_np=depa_np if depa_np<=depb_np & depa_np~=. & depb_np~=.;replace deplo_np=depb_np if depa_np>depb_np & depa_np~=. & depb_np~=.;la var deplo_np "IDEP - Lower dyadic np score";*comment:  higher of dyadic national price dependence scores;gen dephi_np=depa_np if depa_np>depb_np & depa_np~=. & depb_np~=.;replace dephi_np=depb_np if depa_np<=depb_np & depa_np~=. & depb_np~=.;la var dephi_np "IDEP - Higher dyadic np score";*comment:  interdependence national prices;gen jtdep_np=depa_np*depb_np;la var jtdep_np "IDEP - Product dyadic np score";*comment:  OPERATIONALIZING CONTIGUITY;*comment:  calculate contiguity for states separated by less than 150 mi of water, Table 1 & 2;gen contig=1 if conttype<=4 & conttype>0 & conttype~=.;replace contig=0 if contig==.;la var contig "DISTANCE - contiguity dummy";*comment:  OPERATIONALIZING MAJOR POWER;*comment:  identify major power dyads, Table 1 & 2 ;gen majpdyds=1 if (statea==2 | statea==200 | statea==220 | statea==365 | statea==710 | stateb==2 | stateb==200 | stateb==220 | stateb==365 | stateb==710);replace majpdyds=0 if majpdyds==.;la var majpdyds "CAP - Major power in dyad";*comment:  constructing the Oneal and Russett version of the temporal spline, see Beck, Katz, and Tucker 1998;replace onset1=0 if onset1==.;*btscs onset1 year statea stateb, g(orypeace) nspline(4);*ren _spline1 peaceyr1;*ren _spline2 peaceyr2;*ren _spline3 peaceyr3;*ren _spline4 peaceyr4;sort dyadidyr;mkspline peaceyr 4 = yrspeace, marginal;iis dyadid;tis year;drop demauta demautb depa depb imputed conttype depa_np depb_np dephi_np deplo_np jtdep_np yrspeace peaceyr1 peaceyr2 peaceyr3 peaceyr4;compress;sort dyadidyr;order dyadidyr dyadid cntryera cntryerb statea stateb year demlo demhi jntdem demdumy2 demdumy1 deplo dephi jntdep alliesr contig logdstab lncaprt majpdyds;save capitalistpeace_012007.dta, replace;*comment:  OPERATIONALIZING THE DEPENDENT VARIABLE;*comment:  add Maoz dyadic MID variables;*comment:  first prepare the Maoz MID data;use dyadmid60.dta;keep STATEA STATEB YEAR FATLEV HIHOST RECIP;gen maoznew=1;ren STATEA statea;ren STATEB stateb;ren YEAR year;ren FATLEV fatlev;ren HIHOST hihost;ren RECIP recip;gen long dyadidyr=((statea*1000000)+(stateb*1000)+(year-1000));replace fatlev=. if fatlev==-9;replace recip=1 if recip==-1;sort dyadidyr;compress;order dyadidyr statea stateb year maoznew fatlev hihost recip;save maozmid.dta, replace;*comment:  must first remove duplicate MID dyadyears;use maozmid.dta;egen highhost=max(hihost), by(dyadidyr);drop hihost;ren highhost hihost;sort dyadidyr;egen reciproc=max(recip), by(dyadidyr);drop recip;ren reciproc recip;sort dyadidyr;egen fatlevl=max(fatlev), by(dyadidyr);drop fatlev;ren fatlevl fatlev;sort dyadidyr;drop if dyadidyr==dyadidyr[_n-1];sort dyadidyr;save temp.dta, replace;erase maozmid.dta;*comment:  must add maoz data to dyad pop. and calculate leading dep. variable;use dyadsamp.dta;dyadtscs id year if year>1948 & year<1994, data(tempdyad);ren ida statea;ren idb stateb;gen long dyadidyr=((statea*1000000)+(stateb*1000)+(year-1000));sort dyadidyr;merge dyadidyr using temp.dta;tab _merge;drop if _merge==2;drop _merge;sort dyadidyr;*comment: generating leading dep variable;gen maoznewl=maoznew[_n+1] if statea==statea[_n+1] & stateb==stateb[_n+1];drop maoznew;replace maoznewl=0 if maoznewl==.;gen fatlevl=fatlev[_n+1] if statea==statea[_n+1] & stateb==stateb[_n+1];replace fatlevl=0 if fatlevl==.;drop fatlev;gen hihostl=hihost[_n+1] if statea==statea[_n+1] & stateb==stateb[_n+1];replace hihostl=0 if hihostl==.;drop hihost;gen recipl=recip[_n+1] if statea==statea[_n+1] & stateb==stateb[_n+1];replace recipl=0 if recipl==.;drop recip;gen warl=0 if hihostl~=.;replace warl=1 if hihostl==5;gen deadlyl=0 if fatlevl~=.;replace deadlyl=1 if fatlevl>=1;save tempdyad.dta, replace;*comment:  now add Maoz dyad data to Oneal and Russett data;use capitalistpeace_012007.dta;merge dyadidyr using tempdyad.dta;tab _merge;drop if _merge==2;rename _merge sample;la var sample "MERGE - 1= O&R,2=MAOZ,3=both";la var maoznew "MID - Maoz dyadic onset";la var maoznewl "MID - lead Maoz dyadic onset";la var fatlevl "MID - lead Maoz fatality level";la var hihostl "MID - lead Maoz hi hostility";la var recipl "MID - lead Maoz recip dummy?";la var warl "MID - lead Maoz wars";la var deadlyl "MID - lead Maoz deadly MID";*comment:  discrepancies between the Maoz and O&R dep. variable;tab onset1 maoznewl;drop onset1;*comment:  MIDs in Maoz that are selected out of the O&R sample;tab maoznewl sample;btscs warl year statea stateb, g(waryrs) nspline(3);sort dyadidyr;ren _spline1 waryear1;ren _spline2 waryear2;ren _spline3 waryear3;btscs deadlyl year statea stateb, g(deadyrs) nspline(3);sort dyadidyr;ren _spline1 deadyer1;ren _spline2 deadyer2;ren _spline3 deadyer3;btscs maoznewl year statea stateb, g(maozyrs) nspline(3);sort dyadidyr;drop fatlevl hihostl recipl;save capitalistpeace_012007.dta, replace;erase temp.dta;erase tempdyad.dta;*comment:  adding capability data;merge dyadidyr using capabil.dta;tab _merge;drop if _merge==2;drop _merge;sort dyadidyr;gen cinclo=cinca if cinca<=cincb & cinca~=. & cincb~=.;replace cinclo=cincb if cinca>cincb & cinca~=. & cincb~=.;la var cinclo "CINC - Lower of dyadic scores";gen cinchi=cincb if cincb>=cinca & cinca~=. & cincb~=.;replace cinchi=cinca if cinca>cincb & cinca~=. & cincb~=.;la var cinchi "CINC - Higher of dyadic scores";*comment:  OPERATIONALIZING REGIONAL DUMMIES;gen region=0;replace region=rega if rega==regb;drop rega regb;gen namerica=0;replace namerica=1 if region==1 & statea<100 & stateb<100;gen samerica=0;replace samerica=1 if region==1 & statea>99 & stateb>99;gen europe=0;replace europe=1 if region==2;gen africa=0;replace africa=1 if region==3;gen nafmeast=0;replace nafmeast=1 if region==4;gen asia=0;replace asia=1 if region==5;gen pacific=0;replace pacific=1 if region==6;drop region;compress;save capitalistpeace_012007.dta, replace;*comment:  OPERATIONALIZING ALLIANCE;*comment:  adding third party alliance ties - Appendix;*comment:  preparing the raw data;use 3rdpartyallymod.dta;sort dyadidyr;drop midno all11 all22 sum2type;ren side1 statea;ren side2 stateb;ren midstart year;egen linktype=min(ltype), by(dyadidyr);drop ltype;sort dyadidyr;egen thirdeth=max(midc), by(dyadidyr);drop midc;sort dyadidyr;egen statalya=min(type11), by(dyadidyr);drop type11;sort dyadidyr;egen statalyb=min(type22), by(dyadidyr);drop type22;sort dyadidyr;egen bondbond=min(str2bond), by(dyadidyr);drop str2bond;sort dyadidyr;drop if dyadidyr==dyadidyr[_n-1];save temp.dta;*comment:  adding the set of second year dyads;gen mark=1 if midend>year & midend~=. & year~=.;drop if mark==.;gen yer=year+1;drop dyadidyr year mark;ren yer year;move year thirdeth;gen long dyadidyr = ((statea*1000000)+(stateb*1000)+(year-1000));move dyadidyr linktype;sort dyadidyr;des;append using temp.dta;gen thirdpty=1 if linktype==2;gen fourprty=1 if linktype==1;replace thirdpty=0 if thirdpty==.;replace fourprty=0 if fourprty==.;sort dyadidyr thirdpty fourprty;drop if dyadidyr==dyadidyr[_n+1];sort dyadidyr;drop linktype midend;move fourprty thirdeth;move thirdpty fourprty;save tempdyad.dta;*comment:  now add third party data;use capitalistpeace_012007.dta;merge dyadidyr using tempdyad.dta;tab _merge;drop if _merge==2;drop _merge;drop statalya statalyb;replace thirdpty=0 if thirdpty==.;replace fourprty=0 if fourprty==.;replace thirdeth=0 if thirdeth==.;la var thirdpty "ALLY - initial vs. enemy ally A-C/B-D";la var fourprty "ALLY - ally vs. ally link C-D/D-C";la var thirdeth "ALLY - is initial dispute deadly?";*la var statalya "alliance type for A";*la var statalyb "alliance type for B";la var bondbond "ALLY - 1=2defpacs,2=defpacentent,3=2entents, etc.";drop cinca cincb bondbond thirdeth;sort dyadidyr;save capitalistpeace_012007.dta, replace;erase temp.dta;erase tempdyad.dta;*comment:  merging GDP (development) and trade data;*comment:  each dataset must be merged twice (once for each actor in the dyad);*comment:  GDP data;sort cntryera;rename cntryera cntryer;merge cntryer using pwtmod.dta;tab _merge;drop if _merge==2;drop _merge state origin;rename cntryer cntryera;rename pop popa;rename rgdp85pc rgdp85pa;rename gdppc gdppca;*replace rgdp85pa=ln(rgdp85pa);la var popa "PWT - population (1000's) A";la var rgdp85pa "PWT - ln. real percap GDP A";la var gdppca "PWT - GDP percap A";sort cntryerb;rename cntryerb cntryer;merge cntryer using pwtmod.dta;tab _merge;drop if _merge==2;drop _merge state origin;rename cntryer cntryerb;rename pop popb;rename rgdp85pc rgdp85pb;rename gdppc gdppcb;*replace rgdp85pb=ln(rgdp85pb);la var popb "PWT - population (1000's) B";la var rgdp85pb "PWT - ln. real percap GDP B";la var gdppcb "PWT - GDP percap B";compress;sort dyadidyr;save capitalistpeace_012007.dta, replace;*comment:  bringing in data for markets;use gleditschtrade.dta;gen long cntryer=((statea*10000)+year);sort cntryer;gen exptimpt=(export+import);egen open=sum(exptimpt), by(cntryer);drop exptimpt cntryer;sort dyadidyr;save temp.dta, replace;*comment:  merging the trade data;use capitalistpeace_012007.dta;sort dyadidyr;merge dyadidyr using temp.dta;tab _merge;drop if _merge==2;drop _merge export_t import_t;gen tradea=(((import+export)*1000)/(gdppca*popa));gen opena=(open*1000/(gdppca*popa));drop gdppca open import export;ren dyadidyr dyadtemp;gen long dyadidyr=((stateb*1000000)+(statea*1000)+(year-1000));sort dyadidyr;merge dyadidyr using temp.dta;tab _merge;drop if _merge==2;drop _merge export_t import_t;gen tradeb=(((import+export)*1000)/(gdppcb*popb));gen openb=(open*1000/(gdppcb*popb));drop gdppcb open import export dyadidyr;ren dyadtemp dyadidyr;sort dyadidyr;la var tradea "PWT - imports+exports/GDP";la var tradeb "PWT - imports+exports/GDP";la var opena "PWT - sum(import+export)/GDP";la var openb "PWT - sum(import+export)/GDP";*comment:  OPERATIONALIZING DEVELOPMENT;*comment:  constructing dyadic measures of GDPPC, Table 1 & 2;gen rgdppclo = rgdp85pa if rgdp85pa<= rgdp85pb & rgdp85pa~=. & rgdp85pb~=.;replace rgdppclo = rgdp85pb if rgdp85pa> rgdp85pb & rgdp85pa~=. & rgdp85pb~=.;la var rgdppclo "PWT - Lower of dyadic GDP scores";gen rgdppchi = rgdp85pb if rgdp85pb>= rgdp85pa & rgdp85pa~=. & rgdp85pb~=.;replace rgdppchi = rgdp85pa if rgdp85pa> rgdp85pb & rgdp85pa~=. & rgdp85pb~=.;la var rgdppchi "PWT - Higher of dyadic GDP scores";gen rgdppcl2=rgdppclo*rgdppclo;la var rgdppcl2 "PWT - Lower dyadic GDP score^2";gen rgdpdist=rgdppclo/logdstab;la var rgdpdist "PWT - inter, rgdppclo/dist";gen rgdppcln = ln(rgdppclo);la var rgdppclo "PWT - ln of lower GDP scores";gen rgdppchn = ln(rgdppchi);la var rgdppchi "PWT - ln of higher GDP scores";gen rgdpcln2=rgdppcln*rgdppcln;la var rgdpcln2 "PWT - ln of lower GDP score^2";gen gdpdisln=((ln(rgdppclo))/logdstab);la var gdpdisln "PWT - ln of rgdppclo/dist";*comment:  OPERATIONALIZING MARKETS;*comment:  Trade Dependence, Table 1 & 2;gen tradelo=tradea if tradea<=tradeb & tradea~=. & tradeb~=.;replace tradelo=tradeb if tradea>tradeb & tradea~=. & tradeb~=.;la var tradelo "TRADE - Lower of dyadic scores";gen tradehi=tradea if tradea>tradeb & tradea~=. & tradeb~=.;replace tradehi=tradeb if tradea<=tradeb & tradea~=. & tradeb~=.;la var tradehi "TRADE - Higher of dyadic scores";gen jnttrade=tradea*tradeb;la var jnttrade "TRADE - tradea*tradeb";*comment:  IMF financial openness - Appendix;gen openlo=opena if opena<=openb & opena~=. & openb~=.;replace openlo=openb if opena>openb & opena~=. & openb~=.;la var openlo "TRADE - Lower of openness";*comment:  generate interaction term, demlo and rgdppclo - Appendix;gen demgdplo = demlo*rgdppclo;la var demgdplo "Mousseau - dev*dem interaction term";gen demgdpln = demlo*(ln(rgdppclo));la var demgdpln "Mousseau - ln(dev)*dem interaction term";*comment:  generate interaction term, lnrgdppc and contig, Table 1 & 2;gen gdpcontg = rgdppclo*contig;la var gdpcontg "GDP - wealth discourages conquest";gen gdplnctg = (ln(rgdppclo))*contig;la var gdplnctg "GDP - wealth discourages conquest";compress;sort dyadidyr;drop popa rgdp85pa popb rgdp85pb tradea opena tradeb openb;save capitalistpeace_012007.dta, replace;erase temp.dta;*comment:  OPERATIONALIZING INTERESTS, Table 1 & 2;*comment:  add the measure of national interest similarity;merge dyadidyr using affinity.dta;tab _merge;drop if _merge==2;drop _merge;sort dyadidyr;save capitalistpeace_012007.dta, replace;*comment:  calculating residuals of affinity;regress sun2cati demlo demhi;predict temppred;gen residsun=sun2cati-temppred;drop temppred;la var residsun "AFFINITY - sun2cati unexplained by demlo, demhi";*comment:  adding igo similarity - Appendix;merge dyadidyr using similarigo.dta;tab _merge;drop if _merge==2;drop _merge;compress;sort dyadidyr;save capitalistpeace_012007.dta, replace;*comment:  OPERATIONALIZING MARKETS - Appendix;*comment:  merging IMF capital variables;merge dyadidyr using IMFcapdata.dta;tab _merge;drop if _merge==2;drop _merge;gen capdumy=0;replace capdumy=1 if capitall>=5 & capitall~=.;la var capopenl "IMF - govt financial openness, low";la var capopenh "IMF - govt financial openness, high";la var fdi_gdpl "IMF - gross fdi over gdp ppp, low";la var fdi_gdph "IMF - gross fdi over gdp ppp, high";la var ceq_gdpl "IMF - cum. equity invest/gdpppp, low";la var ceq_gdph "IMF - cum. equity invest/gdpppp, high";la var portfl "IMF - portfolio invest, % of gdp-ppp, low";la var portfh "IMF - portfolio invest, % of gdp-ppp, high";la var capitall "IMF - gross priv cap flows, % of gdp-ppp, low";la var capitalh "IMF - gross priv cap flows, % of gdp-ppp, high";la var capdumy "IMF - dummy, 1 if capitall>=5";compress;sort dyadidyr;save capitalistpeace_012007.dta, replace;*comment:  constructing, merging and assessing the economic liberalism data;*comment:  constructing sample;use esplccod;cross using esplyear;gen long cntryer=((ccode*10000)+year);sort cntryer;order cntryer ccode year;merge cntryer using econlib.dta;tab _merge;drop if _merge==2;sort cntryer;drop _merge;*comment:  substituting values for missing;gen econfree=econfre;replace econfree=econfree[_n-1] if econfree==. & econfree[_n-1]~=. & ccode==ccode[_n-1];*comment:  interpolating data;ipolate econfre year, g(ieconfre) by(ccode);sort cntryer;ipolate govsize year, g(igovsize) by(ccode);sort cntryer;ipolate econstru year, g(ieconstr) by(ccode);sort cntryer;ipolate monpolcy year, g(imonplcy) by(ccode);sort cntryer;ipolate altmoney year, g(ialtmony) by(ccode);sort cntryer;ipolate proprite year, g(iproprit) by(ccode);sort cntryer;ipolate freetrad year, g(ifretrad) by(ccode);sort cntryer;ipolate freecapm year, g(ifrecapm) by(ccode);sort cntryer;compress;save elibdata.dta, replace;*comment:  now merging economic liberalism data;use capitalistpeace_012007.dta;keep dyadidyr cntryera cntryerb year;drop if year < 1970;rename cntryera cntryer;sort cntryer;merge cntryer using elibdata.dta;tab _merge;drop if _merge==2;drop _merge govsize econstru monpolcy altmoney proprite freetrad freecapm;ren cntryer cntryera;ren cntryerb cntryer;ren econfre econfrea;ren econfree ecofreea;ren ieconfre iecofrea;sort cntryer;merge cntryer using elibdata.dta;tab _merge;drop if _merge==2;drop _merge govsize econstru monpolcy altmoney proprite freetrad freecapm;rename cntryer cntryerb;ren econfre econfreb;ren econfree ecofreeb;ren ieconfre iecofreb;sort dyadidyr;*comment:  lower of economic liberalism indicators;gen econfrel=econfrea if econfrea<=econfreb & econfrea~=. & econfreb~=.;replace econfrel=econfreb if econfrea>econfreb & econfrea~=. & econfreb~=.;la var econfrel "ECONLIB - Lower econ lib 5 year";gen iecofrel=iecofrea if iecofrea<=iecofreb & iecofrea~=. & iecofreb~=.;replace iecofrel=iecofreb if iecofrea>iecofreb & iecofrea~=. & iecofreb~=.;la var iecofrel "ECONLIB - ipolate lower econ lib all years";drop cntryera cntryerb ccode econfrea ecofreea iecofrea econfreb ecofreeb iecofreb;drop igovsize ieconstr imonplcy ialtmony iproprit ifretrad ifrecapm;gen elibdumy=1 if iecofrel~=.;la var elibdumy "ECONLIB - dummy for sample";order dyadidyr year elibdumy;compress;save temp2.dta, replace;erase elibdata.dta;*comment:  merge the economic liberalism data with the larger dataset;use capitalistpeace_012007.dta;merge dyadidyr using temp2.dta;tab _merge;drop if _merge==2;drop _merge;replace elibdumy=0 if elibdumy==.;sort dyadidyr;save capitalistpeace_012007.dta, replace;erase temp2.dta;*comment:  merging the Quinn openness variable;use dqamt5099_mod2.dta, replace;gen long cntryer=((state*10000)+year);move cntryer state;keep cntryer capital;sort cntryer;compress;save tempfile.dta, replace;*comment:  the data must be merged twice (once for each actor in the dyad);use capitalistpeace_012007.dta;sort cntryera;rename cntryera cntryer;merge cntryer using tempfile.dta;tab _merge;drop if _merge==2;drop _merge;ren cntryer cntryera;ren capital capitala;la var capitala "QUINN - Quinn capital account openness A";sort cntryerb;rename cntryerb cntryer;merge cntryer using tempfile.dta;tab _merge;drop if _merge==2;drop _merge;ren cntryer cntryerb;ren capital capitalb;la var capitalb "QUINN - Quinn capital account openness B";*comment:  generating dyadic variables;gen capitalo=capitala if capitala<capitalb & capitala~=. & capitalb~=.;replace capitalo=capitalb if capitalb<=capitala & capitala~=. & capitalb~=.;la var capitalo "QUINN - lower of dyadic scores";gen capitlhi=capitalb if capitalb>capitala & capitala~=. & capitalb~=.;replace capitlhi=capitala if capitala>=capitalb & capitala~=. & capitalb~=.;la var capitlhi "QUINN - higher of dyadic scores";gen jtcapitl=capitala*capitalb;la var jtcapitl "QUINN - capitala*capitalb";*comment:  interpolating data;sort cntryera;ipolate capitala year, g(icapitla) by(statea);sort cntryerb;ipolate capitalb year, g(icapitlb) by(stateb);gen icapitlo=icapitla if icapitla<icapitlb & icapitla~=. & icapitlb~=.;replace icapitlo=icapitlb if icapitlb<=icapitla & icapitla~=. & icapitlb~=.;la var icapitlo "QUINN - interpolated capitalo";drop icapitla icapitlb;compress;sort dyadidyr;save capitalistpeace_012007.dta, replace;*comment:  merging and assessing the Chinn and Ito openness variable;use kaopen_mod2.dta, replace;gen long cntryer=((state*10000)+year);move cntryer state;sort cntryer;drop state;compress;save tempfile.dta, replace;*comment:  the data must be merged twice (once for each actor in the dyad);use capitalistpeace_012007.dta;sort cntryera;rename cntryera cntryer;merge cntryer using kaopen.dta;tab _merge;drop if _merge==2;drop _merge state;ren cntryer cntryera;ren kaopen kaopena;la var kaopena "KAOPEN - Chinn Ito capital openness";sort cntryerb;rename cntryerb cntryer;merge cntryer using kaopen.dta;tab _merge;drop if _merge==2;drop _merge state;ren cntryer cntryerb;ren kaopen kaopenb;la var kaopenb "KAOPEN - Chinn Ito capital openness";*comment:  generating dyadic variables;gen kaopenlo=kaopena if kaopena<kaopenb & kaopena~=. & kaopenb~=.;replace kaopenlo=kaopenb if kaopenb<=kaopena & kaopena~=. & kaopenb~=.;la var kaopenlo "KAOPEN - lower of dyadic scores";gen kaopenhi=kaopenb if kaopenb>kaopena & kaopena~=. & kaopenb~=.;replace kaopenhi=kaopena if kaopena>=kaopenb & kaopena~=. & kaopenb~=.;la var kaopenhi "KAOPEN - higher of dyadic scores";gen jtkaopen=kaopena*kaopenb;la var jtkaopen "KAOPEN - kaopena*kaopenb";compress;sort dyadidyr;save capitalistpeace_012007.dta, replace;erase tempfile.dta;*comment:  OPERATIONALIZING ALLIANCE - Appendix;*comment:  merging and assessing the EU dummy data;*comment:  the data must be merged twice (once for each actor in the dyad);sort statea;rename statea state;merge state using natowarsaw.dta;tab _merge;drop if _merge==2;drop _merge;ren state statea;gen natoa=0;gen warsawa=0;replace natoa=1 if nstrtyer~=. & nstrtyer<=year & nendyear>=year;replace warsawa=1 if wpstrtyer~=. & wpstrtyer<=year & wpendyer>=year;drop nstrtyer nendyear wpstrtyer wpendyer;sort stateb;rename stateb state;merge state using natowarsaw.dta;tab _merge;drop if _merge==2;drop _merge;ren state stateb;gen natob=0;gen warsawb=0;replace natob=1 if nstrtyer~=. & nstrtyer<=year & nendyear>=year;replace warsawb=1 if wpstrtyer~=. & wpstrtyer<=year & wpendyer>=year;drop nstrtyer nendyear wpstrtyer wpendyer;gen bothnato=0;replace bothnato=1 if natoa==1 & natob==1;la var bothnato "NATO dummy";gen bothwarsaw=0;replace bothwarsaw=1 if warsawa==1 & warsawb==1;la var bothwarsaw "WARSAW dummy";drop natoa natob warsawa warsawb;gen bothboth=bothnato;replace bothboth=1 if bothwarsaw==1;la var bothboth "NATO & WARSAW dummy";*comment:  OPERATIONALIZING NUCLEAR POWER STATUS - Appendix;gen nucleara=0;replace nucleara=1 if statea==2 & year>=1945;replace nucleara=1 if statea==365 & year>=1949;replace nucleara=1 if statea==200 & year>=1952;replace nucleara=1 if statea==220 & year>=1960;replace nucleara=1 if statea==710 & year>=1964;replace nucleara=1 if stateb==666 & year>=1966;replace nucleara=1 if statea==560 & year>=1979 & year<=1991;replace nucleara=1 if statea==750 & year>=1988;replace nucleara=1 if statea==770 & year>=1987;gen nuclearb=0;replace nuclearb=1 if stateb==2 & year>=1945;replace nuclearb=1 if stateb==365 & year>=1949;replace nuclearb=1 if stateb==200 & year>=1952;replace nuclearb=1 if stateb==220 & year>=1960;replace nuclearb=1 if stateb==710 & year>=1964;replace nuclearb=1 if statea==666 & year>=1966;replace nuclearb=1 if stateb==560 & year>=1979 & year<=1991;replace nuclearb=1 if stateb==750 & year>=1988;replace nuclearb=1 if stateb==770 & year>=1987;gen nuclear1=0;replace nuclear1=1 if nucleara==1;replace nuclear1=1 if nuclearb==1;la var nuclear1 "NUKE - either state has nukes";gen nuclear2=0;replace nuclear2=1 if nucleara==1 & nuclearb==1;drop nucleara nuclearb;la var nuclear2 "NUKE - both states have nukes";*comment:  OPERATIONALIZING DEMOCRACY - Appendix;*comment:  merging and assessing the Polity IV democracy data;*comment:  the data must be merged twice (once for each actor in the dyad);sort cntryera;rename cntryera cntryer;merge cntryer using polity98mod.dta;tab _merge;drop if _merge==2;drop _merge state;ren cntryer cntryera;replace democ=. if democ<0;replace autoc=. if autoc<0;ren democ democa;ren autoc autoca;ren durable durablea;gen ceddema=0;replace ceddema=1 if democa>=6;gen demautaa=((democa-autoca+10)/2);drop democa autoca;la var demautaa "POLITY - (democa-autoca+10)/2";la var durablea "POLITY - years of regime duration";sort cntryerb;rename cntryerb cntryer;merge cntryer using polity98mod.dta;tab _merge;drop if _merge==2;drop _merge state;ren cntryer cntryerb;replace democ=. if democ<0;replace autoc=. if autoc<0;ren democ democb;ren autoc autocb;ren durable durableb;gen ceddemb=0;replace ceddemb=1 if democb>=6;gen demautbb=((democb-autocb+10)/2);drop democb autocb;la var demautbb "POLITY - (democa-autoca+10)/2";la var durableb "POLITY - years of regime duration";sort dyadidyr;*comment:  constructing dyadic measures;gen politylo=demautaa if demautaa<demautbb & demautaa~=. & demautbb~=.;replace politylo=demautbb if demautbb<=demautaa & demautaa~=. & demautbb~=.;la var politylo "POLITY - Lower of dyadic scores";gen polityhi=demautbb if demautbb>demautaa & demautaa~=. & demautbb~=.;replace polityhi=demautaa if demautaa>=demautbb & demautaa~=. & demautbb~=.;la var polityhi "POLITY - Higher of dyadic scores";gen jtpolity=(demautaa*demautbb);la var jtpolity "POLITY - Product of dyadic scores";gen durabllo=durablea if durablea<durableb & durablea~=. & durableb~=.;replace durabllo=durableb if durableb<=durablea & durablea~=. & durableb~=.;la var durabllo "POLITY - Lower of dyadic regime durability scores";*comment:  generating cederman democracy dummies;gen ceddem1=0;replace ceddem1=1 if ceddema==1;replace ceddem1=1 if ceddemb==1;gen ceddem2=0;replace ceddem2=1 if ceddema==1 & ceddemb==1;drop ceddema ceddemb;la var ceddem1 "CEDERMAN - either democ>=6";la var ceddem2 "CEDERMAN - both democ>=6";*comment:  generating Cederman learning variables;gen demyear1=ceddem1*year;gen demyear2=ceddem2*year;gen autyear1=(1-ceddem1)*year;gen autyear2=(1-ceddem2)*year;la var demyear1 "CEDERMAN - ceddem1*year";la var demyear2 "CEDERMAN - ceddem2*year";la var autyear1 "CEDERMAN - (1-ceddem1)*year";la var autyear2 "CEDERMAN - (1-ceddem2)*year";compress;save capitalistpeace_012007.dta, replace;*comment:  discrepancies between Polity IV data and Oneal & Russett democracy;corr demlo politylo;corr demhi polityhi;tab demlo;tab politylo;tab demhi;tab polityhi;gen marker=1111111 if demlo>politylo & demlo~=. & politylo~=.;tab marker;gen marker2=1111111 if demlo<politylo & demlo~=. & politylo~=.;tab marker2;drop marker marker2 durablea demautaa durableb demautbb;*comment:  merging and assessing the Vanhanen democracy data;*comment:  the data must be merged twice (once for each actor in the dyad);sort cntryera;rename cntryera cntryer;merge cntryer using vanhanendem.dta;tab _merge;drop if _merge==2;drop _merge ccode;rename cntryer cntryera;rename id ida;la var ida "VANDEM - Vanhanen dem A";sort cntryerb;rename cntryerb cntryer;merge cntryer using vanhanendem.dta;tab _merge;drop if _merge==2;drop _merge ccode;rename cntryer cntryerb;rename id idb;la var idb "VANDEM - Vanhanen dem B";sort dyadidyr;*comment:  constructing dyadic measures;gen idlo=ida if ida<=idb & ida~=. & idb~=.;replace idlo=idb if ida>idb & ida~=. & idb~=.;la var idlo "VANDEM - Lower of dyadic scores";gen idhi=ida if ida>idb & ida~=. & idb~=.;replace idhi=idb if ida<=idb & ida~=. & idb~=.;la var idhi "VANDEM - Higher of dyadic scores";gen jntid=(ida*idb);la var jntid "VANDEM - Product of dyadic scores";compress;save capitalistpeace_012007.dta, replace;*comment:  merging and assessing the freedomhouse (Gastil) democracy data;*comment:  the data must be merged twice (once for each actor in the dyad);sort cntryera;rename cntryera cntryer;merge cntryer using freedomhouse.dta;tab _merge;drop if _merge==2;drop _merge ccode;ren cntryer cntryera;ren freeindx freeinda;gen gastdema=(14-(polright+civlib));drop polright civlib;la var gastdema "GASTIL - 14-(polritea+civliba) (0 - 12)";la var freeinda "GASTIL - for A:  0=NF,1=PF,2=F";sort cntryerb;rename cntryerb cntryer;merge cntryer using freedomhouse.dta;tab _merge;drop if _merge==2;drop _merge ccode;ren cntryer cntryerb;ren freeindx freeindb;gen gastdemb=(14-(polright+civlib));drop polright civlib;la var gastdemb "GASTIL - 14-(polriteb+civlibb) (0 - 12)";la var freeindb "GASTIL - for B:  0=NF,1=PF,2=F";sort dyadidyr;*comment:  constructing dyadic measures;gen gasdemlo=gastdema if gastdema<gastdemb & gastdema~=. & gastdemb~=.;replace gasdemlo=gastdemb if gastdemb<=gastdema & gastdema~=. & gastdemb~=.;la var gasdemlo "GASTIL - Lower of dyadic scores";gen gasdemhi=gastdemb if gastdemb>gastdema & gastdema~=. & gastdemb~=.;replace gasdemhi=gastdema if gastdema>=gastdemb & gastdema~=. & gastdemb~=.;la var gasdemhi "GASTIL - Higher of dyadic scores";gen jtgasdem=(gastdema*gastdemb);la var jtgasdem "GASTIL - Product of dyadic scores";compress;drop freeinda gastdema freeindb gastdemb;save capitalistpeace_012007.dta, replace;*comment:  adding contiguity distance variables;merge dyadidyr using distance.dta;tab _merge;drop if _merge==2;drop _merge;*comment:  CONSTRUCTING CONTIGUITY, Table 1 & 2;gen cntigdum=1 if cntig<=4 & cntig~=.;replace cntigdum=0 if cntig>4 & cntig~=.;la var cntigdum "CONTIG - 1 if cntig<=4";drop cntig;sort dyadidyr;compress;*comment:  CONSTRUCTING DISTANCE, Table 1 & 2;gen tempdist=distance;replace tempdist=1 if distance==0;gen logdist=ln(tempdist);drop tempdist pol_rel;la var distance "DISTANCE - km's cap to cap";la var logdist "DISTANCE - ln(km's) cap to cap";*comment:  CONSTRUCTING GDPPC X CONTIGUITY INTERACTION TERM, Table 1 & 2; gen gdpcntig=rgdppclo*cntigdum;la var gdpcntig "CONTIG - rgdppclo x cntigdum"; sort dyadidyr;compress;save capitalistpeace_012007.dta, replace;*comment:  descriptive stats on the whole dataset;describe;summarize;corr demlo demhi deplo sun2cati capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt;corr politylo polityhi tradelo sun2cati capopenl rgdppclo gdpcontg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt;*_______________________ RESULTS __________________________;*comment:  TABLE 1;*Table 1, Model 1:  replication of Oneal and Russett standard model;logit maoznewl demlo demhi deplo contig logdstab majpdyds alliesr lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*Table 1, Model 2:  adding Fin.Open(Low);logit maoznewl demlo demhi deplo capopenl contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*Table 1, Model 3:  adding GDPPC(Low);logit maoznewl demlo demhi deplo capopenl rgdppclo contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*Table 1, Model 4:  adding GDPPC x Contig.;logit maoznewl demlo demhi deplo capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*Table 1, Model 5:  adding Interests;logit maoznewl demlo demhi deplo capopenl rgdppclo gdpcontg sun2cati contig logdstab majpdyds allies lncaprt _spline*, cluster(dyadid);
*comment:  Figure 1;


*comment:  TABLE 2;*Table 2, Model 6:  replication of Model 1 for wars;logit warl demlo demhi deplo contig logdstab majpdyds alliesr lncaprt namerica samerica europe africa nafmeast asia waryear*, cluster(dyadid);*Table 2, Model 7:  adding Fin.Open.(Low), GDPPC(Low) and GDPPC x Contig.;logit warl demlo demhi deplo capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia waryear*, cluster(dyadid);*Table 2, Model 8:  replication of Model 1 for fatal MIDS;logit deadlyl demlo demhi deplo contig logdstab majpdyds alliesr lncaprt namerica samerica europe africa nafmeast asia deadyer*, cluster(dyadid);*Table 2, Model 9:  adding Fin.Open.(Low), GDPPC(Low) and GDPPC x Contig.;logit deadlyl demlo demhi deplo capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia deadyer*, cluster(dyadid);*Appendix - Table 3;*comment:  different measures of democracy;*Polity IV;logit maoznewl politylo polityhi tradelo sun2cati capopenl rgdppclo gdpcontg contig distance majpdyds alliesr thirdpty fourprty cinclo lncaprt _spline*, cluster(dyadid);*Polity IV:  adding capitall;logit maoznewl politylo polityhi tradelo sun2cati capitall rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt _spline*, cluster(dyadid);*Polity IV:  adding fdi_gdpl;logit maoznewl politylo polityhi tradelo sun2cati fdi_gdpl rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt _spline*, cluster(dyadid);*Polity IV:  adding portfl;logit maoznewl politylo polityhi tradelo sun2cati portfl rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt _spline*, cluster(dyadid);*Polity IV:  adding openlo and mousseau;logit maoznewl politylo polityhi demgdpln tradelo openlo sun2cati capopenl rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt _spline*, cluster(dyadid);*demdummy;logit maoznewl demdumy2 deplo sun2cati capopenl rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*idlo idhi Vanhanen data;logit maoznewl idlo idhi tradelo sun2cati iecofrel rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*jntid Vanhanen data and KAOPEN data;logit maoznewl jntid tradelo sun2cati kaopenlo rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*gasdemlo gasdemhi Gastil Freedom House data;logit maoznewl gasdemlo gasdemhi tradelo sun2cati fdi_gdpl rgdppcln gdplnctg cntigdum logdist majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*jtgasdem Gastil Freedom House data;logit maoznewl jtgasdem tradelo sun2cati fdi_gdpl rgdppcln gdplnctg cntigdum logdist majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*comment:  other measures for markets;*Chinn and Ito;logit maoznewl politylo polityhi tradelo sun2cati kaopenlo rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*jtkaopen;logit maoznewl politylo polityhi tradelo sun2cati jtkaopen rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*econfrel;logit maoznewl politylo polityhi tradelo sun2cati econfrel rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*iecofrel;logit maoznewl politylo polityhi tradelo sun2cati iecofrel rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*icapitlo;logit maoznewl demlo demhi deplo sun2cati icapitlo rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*comment:  other measures for Development;*Mossaeau controls:  replication of Oneal and Russett standard model;logit maoznewl demlo demhi deplo demgdpln contig logdstab majpdyds alliesr cinclo lncaprt thirdpty fourprty namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*adding capital;logit maoznewl demlo demhi deplo capopenl demgdpln contig logdstab majpdyds allies cinclo lncaprt thirdpty fourprty namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*adding GDP/pop.;logit maoznewl demlo demhi deplo capopenl rgdppclo demgdpln contig logdstab majpdyds allies cinclo lncaprt thirdpty fourprty namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*adding contiguity x GDP/pop.;logit maoznewl demlo demhi deplo capopenl rgdppclo gdpcontg demgdpln contig logdstab majpdyds allies cinclo lncaprt thirdpty fourprty namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*adding interests;logit maoznewl demlo demhi deplo capopenl rgdppclo gdpcontg sun2cati demgdpln contig logdstab majpdyds allies cinclo lncaprt thirdpty fourprty _spline*, cluster(dyadid);* Measures for similar interests;logit maoznewl demlo demhi deplo sun2cati capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*UN residuals;logit maoznewl demlo demhi deplo residsun capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*IGO ties;logit maoznewl demlo demhi deplo s_igocount_uw capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*learning - Cederman;logit maoznewl demlo demhi deplo sun2cati capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia demyear1 autyear1, cluster(dyadid);logit maoznewl demlo demhi deplo sun2cati capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia demyear2 autyear2, cluster(dyadid);logit maoznewl demlo demhi deplo sun2cati capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia demyear1, cluster(dyadid);logit maoznewl demlo demhi deplo sun2cati capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia demyear2, cluster(dyadid);*comment:  basic analysis plus controls;*replication of Oneal and Russett standard model;logit maoznewl demlo demhi deplo contig logdstab majpdyds alliesr cinclo lncaprt thirdpty fourprty namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*adding capital;logit maoznewl demlo demhi deplo capopenl contig logdstab majpdyds allies cinclo lncaprt thirdpty fourprty namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*adding GDP/pop.;logit maoznewl demlo demhi deplo capopenl rgdppclo contig logdstab majpdyds allies cinclo lncaprt thirdpty fourprty namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*adding contiguity x GDP/pop.;logit maoznewl demlo demhi deplo capopenl rgdppclo gdpcontg contig logdstab majpdyds allies cinclo lncaprt thirdpty fourprty namerica samerica europe africa nafmeast asia _spline*, cluster(dyadid);*adding interests;logit maoznewl demlo demhi deplo capopenl rgdppclo gdpcontg sun2cati contig logdstab majpdyds allies cinclo lncaprt thirdpty fourprty _spline*, cluster(dyadid);*comment:  replicating table 1, basic analysis using GEE;*replication of Oneal and Russett standard model;xtgee maoznewl demlo demhi deplo contig logdstab majpdyds alliesr lncaprt namerica samerica europe africa nafmeast asia , family(binomial) link(logit) corr(ar1) force robust;*adding capital;xtgee maoznewl demlo demhi deplo capopenl contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia , family(binomial) link(logit) corr(ar1) force robust;*adding GDP/pop.;xtgee maoznewl demlo demhi deplo capopenl rgdppclo contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia , family(binomial) link(logit) corr(ar1) force robust;*adding contiguity x GDP/pop.;xtgee maoznewl demlo demhi deplo capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt namerica samerica europe africa nafmeast asia , family(binomial) link(logit) corr(ar1) force robust;*adding interests;xtgee maoznewl demlo demhi deplo capopenl rgdppclo gdpcontg sun2cati contig logdstab majpdyds allies lncaprt, family(binomial) link(logit) corr(ar1) force robust;*comment:  different measures of democracy using GEE;*demdummy;xtgee maoznewl demdumy2 deplo sun2cati capopenl rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*idlo idhi Vanhanen data;xtgee maoznewl idlo idhi tradelo sun2cati iecofrel rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*jntid Vanhanen data and KAOPEN data;xtgee maoznewl jntid tradelo sun2cati kaopenlo rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*gasdemlo gasdemhi Gastil Freedom House data;xtgee maoznewl gasdemlo gasdemhi tradelo sun2cati fdi_gdpl rgdppcln gdplnctg cntigdum logdist majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*jtgasdem Gastil Freedom House data;xtgee maoznewl jtgasdem tradelo sun2cati fdi_gdpl rgdppcln gdplnctg cntigdum logdist majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*comment:  replicating table 2, different IMF measures using GEE;*capopenl;xtgee maoznewl politylo polityhi tradelo sun2cati capopenl rgdppclo gdpcontg contig distance majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*capitall;xtgee maoznewl politylo polityhi tradelo sun2cati capitall rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*fdi_gdpl;xtgee maoznewl politylo polityhi tradelo sun2cati fdi_gdpl rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*portfl;xtgee maoznewl politylo polityhi tradelo sun2cati portfl rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*openlo and mousseau;xtgee maoznewl politylo polityhi demgdpln tradelo openlo sun2cati capopenl rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*comment:  other economic measures using GEE;*kaopenlo;xtgee maoznewl politylo polityhi tradelo sun2cati kaopenlo rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*jtkaopen;xtgee maoznewl politylo polityhi tradelo sun2cati jtkaopen rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*econfrel;xtgee maoznewl politylo polityhi tradelo sun2cati econfrel rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*iecofrel;xtgee maoznewl politylo polityhi tradelo sun2cati iecofrel rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*icapitlo;xtgee maoznewl demlo demhi deplo sun2cati icapitlo rgdppcln gdplnctg contig logdstab majpdyds alliesr thirdpty fourprty cinclo lncaprt namerica samerica europe africa nafmeast asia, family(binomial) link(logit) corr(ar1) force robust;*comment:  additional tests;corr bothwarsaw bothnato;tab bothnato bothwarsaw;logit maoznewl demlo demhi deplo sun2cati bothboth capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt _spline*, cluster(dyadid);logit maoznewl demlo demhi deplo sun2cati bothnato capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt _spline*, cluster(dyadid);logit maoznewl demlo demhi deplo sun2cati bothwarsaw capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt _spline*, cluster(dyadid);logit maoznewl demlo demhi deplo sun2cati nuclear1 capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt _spline*, cluster(dyadid);logit maoznewl demlo demhi deplo sun2cati nuclear2 capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt _spline*, cluster(dyadid);* more additional tests;*data for figure 3 using model 2.1;logit maoznewl politylo deplo sun2cati capopenl rgdppclo gdpcontg contig logdstab majpdyds allies lncaprt _spline*, cluster(dyadid);gen temppred=politylo;replace politylo=0;predict pmin;replace politylo=0+((1/4)*(2.426856-0));predict p14mean;replace politylo=0+((1/2)*(2.426856-0));predict p12mean;replace politylo=0+((3/4)*(2.426856-0));predict p34mean;replace politylo=2.426856;predict pmean;replace politylo=2.426856+((1/2)*2.792056);predict pm12sd;replace politylo=2.426856+(2.792056);predict pm1sd;replace politylo=2.426856+((2)*2.792056);predict pm2sd;replace politylo=10;predict pmax;summarize pmin p14mean p12mean p34mean pmean pm12sd pm1sd pm2sd pmax;drop pmin p14mean p12mean p34mean pmean pm12sd pm1sd pm2sd pmax;replace politylo=temppred;drop temppred;gen temppred=sun2cati;replace sun2cati=-1;predict pmin;replace sun2cati=-1+((1/4)*(0.7390797+1));predict p14mean;replace sun2cati=-1+((1/2)*(0.7390797+1));predict p12mean;replace sun2cati=-1+((3/4)*(0.7390797+1));predict p34mean;replace sun2cati=0.7390797;predict pmean;replace sun2cati=0.7390797+((1/4)*(1-0.7390797));predict pm12sd;replace sun2cati=0.7390797+((1/2)*(1-0.7390797));predict pm1sd;replace sun2cati=0.7390797+((3/4)*(1-0.7390797));predict pm2sd;replace sun2cati=1;predict pmax;summarize pmin p14mean p12mean p34mean pmean pm12sd pm1sd pm2sd pmax;drop pmin p14mean p12mean p34mean pmean pm12sd pm1sd pm2sd pmax;replace sun2cati=temppred;drop temppred;gen temppred=capopenl;replace capopenl=0;predict pmin;replace capopenl=((1/4)*(3.005964));predict p14mean;replace capopenl=((1/2)*(3.005964));predict p12mean;replace capopenl=((3/4)*(3.005964));predict p34mean;replace capopenl=3.005964;predict pmean;replace capopenl=3.005964+((1/2)*1.627334);predict pm12sd;replace capopenl=3.005964+1.627334;predict pm1sd;replace capopenl=3.005964+((2)*1.627334);predict pm2sd;replace capopenl=8;predict pmax;summarize pmin p14mean p12mean p34mean pmean pm12sd pm1sd pm2sd pmax;drop pmin p14mean p12mean p34mean pmean pm12sd pm1sd pm2sd pmax;replace capopenl=temppred;drop temppred;gen temppred=rgdppclo;gen tempprd2=gdpcontg;replace rgdppclo=221;replace gdpcontg=rgdppclo;predict pmin;replace rgdppclo=221+((1/4)*(1760.643-221));replace gdpcontg=rgdppclo;predict p14mean;replace rgdppclo=221+((1/2)*(1760.643-221));replace gdpcontg=rgdppclo;predict p12mean;replace rgdppclo=221+((3/4)*(1760.643-221));replace gdpcontg=rgdppclo;predict p34mean;replace rgdppclo=1760.643;replace gdpcontg=rgdppclo;predict pmean;replace rgdppclo=1760.643+1958.456;replace gdpcontg=rgdppclo;predict pm12sd;replace rgdppclo=1760.643+(2*1958.456);replace gdpcontg=rgdppclo;predict pm1sd;replace rgdppclo=1760.643+(5*1958.456);replace gdpcontg=rgdppclo;predict pm2sd;replace rgdppclo=31969;replace gdpcontg=rgdppclo;predict pmax;summarize pmin p14mean p12mean p34mean pmean pm12sd pm1sd pm2sd pmax;drop pmin p14mean p12mean p34mean pmean pm12sd pm1sd pm2sd pmax;replace rgdppclo=temppred;drop temppred;replace gdpcontg=tempprd2;drop tempprd2;